//
//  CS_Page_QueryPanelView.h
//  Pods
//
//  Created by 网新中研 on 2017/7/19.
//
//

#import <CSUIKit/CSUIKit.h>

#pragma mark --- 宏定义

@class CSQueryModuleModel;

typedef void(^DoQueryBlock)(NSMutableDictionary *params);

/**
 * 描述：
 *      查询参数发生变化的处理
 * 参数：
 *      queryConditions:查询条件
 *      superView:用户显示查询结果的父视图模块
 */
typedef void(^DoModuleQueryBlock)(NSArray *queryConditions, UIView *superView);

/**
 * 描述：
 *      查询参数发生变化的处理
 */
typedef void(^OnConditionChangedBlock)(void);

/**
 * 描述：
 *      点击取消的处理
 *
 */
typedef void(^CancelClickBlock)(void);


typedef void(^NavigationBackBlock)(void);


/**
 * 描述：
 *      布局自定义视图区域
 *
 * 参数：
 *      queryModel:对应的哪个查询模块
 *      primaryY:初始位置
 *      superView:父级视图
 */
typedef CGFloat(^CustomSupportViewDisplayBlock)(CSQueryModuleModel *querymodel, CGFloat primaryY, UIView *superView);

/**
 * 视图类型
 */
typedef enum : NSUInteger {
    
    //默认模式,放在过滤方式中
    CSQueryConditionDisplayMode_Default = 1,
    
    //在查询条件输入框中设置该属性
    CSQueryConditionDisplayMode_InputText = 2,
    
    //在结果集上面的删选栏中显示该属性
    CSQueryConditionDisplayMode_ResultFilterLine = 3,
    
} CSQueryConditionDisplayMode;

#pragma mark --------------------模型对象--------------------

#pragma mark --- 查询模块模型对象

/**
 * 查询模块
 * 分为主体查询，商标查询，法律法规查询，许可证查询等
 */
@interface CSQueryModuleModel : CSUIKitModel

/**
 * 查询模块名称
 */
@property (nonatomic, strong) NSString *queryModuleName;

/**
 * 模块提示文字
 */
@property (nonatomic, strong, readonly) NSString *modulePlaceHolder;

/**
 * 模块查询条件
 */
@property (nonatomic, strong) NSArray *queryModuleConditions;

/**
 * 点击查询处理
 */
@property (nonatomic, copy) DoModuleQueryBlock moduleQueryHandler;

@end



#pragma mark --- 查询条件模型对象

@interface CSConditionModel : CSUIKitModel

@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *placeHolder;
@property (nonatomic, strong) NSString *keyCode;
@property (nonatomic, strong) NSString *value;
@property (nonatomic, strong) UIView *view;
@property (nonatomic, strong) NSString *contentValue;

@property (nonatomic, strong) CSBaseView *originView;

//查询项类型
@property (nonatomic, assign) NSInteger type;

//查询条件显示模式
@property (nonatomic, assign) CSQueryConditionDisplayMode queryConditionDisplayMode;

/**
 * 选项
 */
@property (nonatomic, strong) NSArray *selectItems;

/**
 * 被选中
 */
@property (nonatomic, assign) BOOL isFocused;

/**
 * 输入类型
 */
@property (nonatomic, assign) BOOL isInputTypeProperty;

@property (nonatomic, assign) int index;

/**
 * 是否需要刷新
 */
@property (nonatomic, assign) BOOL isRefreshRequired;

@end

#pragma mark --------------------视图--------------------

#pragma mark --- 过滤条件视图

/**
 * 查询条件过滤视图
 */
@interface CS_Page_QueryFilterPannelView : CSBaseView

/**
 * 当长训条件更改时的处理
 */
@property (nonatomic, copy) OnConditionChangedBlock onConditionChangedHandler;

/**
 * 焦点视图
 */
@property (nonatomic, strong, readonly) UIView *focusedContainerView;

/**
 * 清空视图
 */
-(void)clearContainerViews;

/**
 * 查询条件集合
 */
+(id)page_QueryFilterPannelViewWidthConditions:(NSArray *)queryConditions;

@end

#pragma mark --- 查询界面视图

@interface CS_Page_QueryPanelView : CSBaseView

/**
 * 执行查询操作
 */
@property (nonatomic, copy) DoQueryBlock doQueryClick;

@property (nonatomic, copy) CancelClickBlock cancelClickHandler;

@property (nonatomic, copy) NavigationBackBlock navigationBackHandler;

@property (nonatomic, copy) CustomSupportViewDisplayBlock customSuperViewDisplayHandler;


//@property (nonatomic, strong) UIButton *queryRightButton;

@property (nonatomic, strong) NSString *title;

@property (nonatomic, strong) UIButton *rightButton;

/**
 * 模块集合
 */
@property (nonatomic, strong) NSArray *moduleArray;

@property (nonatomic, strong) NSArray *conditionArray;

@property (nonatomic, strong) NSString *vc_name;

/**
 * 执行搜索方法
 */
-(void)doSearch;

@end
